﻿<%@ Page Language="C#" MasterPageFile="~/Page/PageMasterPage.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Com.Web.coffinegurunaru.home._default" %>
<%@ Import Namespace="Com.Library.DB.Banner" %>
<%@ Import Namespace="Com.Library.DB.Popup" %>
<%@ Import Namespace="Com.Library.DB.Contribute" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Content" runat="server">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tblCenterBanner" align="center" border="0">
  <tr>
    <td background="/images/main/m_img_bg.jpg" style="height:497px;" align="center">
		<table style="width:100px;" border="0" cellspacing="0" cellpadding="0"><tr><td>
		<div style="position:relative; width:1000px; height:497px;">
<% for (int i = 0; i < CenterBanner.Count; i ++ ) { %>
		<div class="m_CenterBanner" style=" position:absolute;left:0px;top:0px; <%=i==0 ? "" : "display:none" %>"><%=CenterBanner[i].Link != string.Empty ? "<a href='" + CenterBanner[i].Link + "' target='" + ( CenterBanner[i].LinkType == CodeLinkType.Self ? "_self" : "_blank" ) + "'>" : "" %><img src="<%=CenterBanner[i].ImageURL %>" width="1000" height="497"><%=CenterBanner[i].Link == string.Empty ? "" : "</a>" %></div>
<% } %>
		</div>
		</td></tr></table>
    </td>
  </tr>
  <tr>
    <td align="center" background="/images/main/contents_bg.gif"><!--contents  -->
      <table width="1000" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="335"><%= BrandBanner.GetBannerGenerator(335, 180)%></td>
        <td width="331"><%= MenuBanner.GetBannerGenerator(331, 180)%></td>
        <td valign="top">
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tblContribute">
          <tr>
            <td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr></tr>
              <tr>
                <td width="432" colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="78" colspan="2" valign="top"><img src="/images/main/story_tit.gif" width="193" height="75"></td>
                        </tr>
                      <tr>
                        <td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<% foreach(ContributeEntity item in ContributeList ) { %>
                          <tr data="{'ImageURL':'<%=item.ImageURL %>', 'LinkURL':'<%=item.LinkURL%>'}" class="m_ContributeData">
                            <td width="27" valign="top">&nbsp;</td>
                            <td width="103" valign="top" class="m_ContributeList"><a href="#"><img src="<%=item.TitleImageURL %>"></a></td>
                          </tr>
<% } %>
                        </table></td>
                      </tr>
                      </table></td>
                    <td width="141" valign="top" style="padding-top:50px"><img src="<%=ContributeList.Count > 0 ? ContributeList[0].ImageURL : string.Empty %>" width="133" height="105" class="m_ContributeImage"></td>
                  </tr>
                  </table></td>
              </tr>
            </table></td>
          </tr>
        </table>

		
		</td>
      </tr>
    </table>
    <!--contents 끝 --></td>
  </tr>
  <tr>
    <td align="center" valign="top" background="/images/main/footer_bg.gif"><table width="1000" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><%= MediaBanner.GetBannerGenerator(335, 128)%></td>
        <td><%= EventBanner.GetBannerGenerator(331, 128)%></td>
        <td><a href="/franchise/request.aspx"><img src="/images/main/contents_franchise.gif" width="331" height="128"></a></td>
      </tr>
    </table></td>
  </tr>
</table>
<script language="javascript" type="text/javascript">
$(function() {

	$("#tblContribute td.m_ContributeList>a").mouseover(function() {
		var data = $(this).closest("tr").tagdata();
		$("#tblContribute img.m_ContributeImage").attr("src", data.ImageURL);
	});

	$("#tblContribute td.m_ContributeList>a").click(function() {
		var data = $(this).closest("tr").tagdata();
		location.href = data.LinkURL;
		return false;
	});
});
</script>

<% foreach (PopupEntity item in PopupList) { %>
<script language="javascript" type="text/javascript">
$(function() {
	var height = "<%=item.Height %>";
	var width = "<%=item.Width %>";
	var top = "<%=item.Top %>";
	var left = "<%=item.Left %>";
	var isCookie =  "<%=item.IsCookie %>";
	var setValue = "";
	
	height = $.trim(height) == "0" ? "" : height;
	width = $.trim(width) == "0" ? "" : width;
	top = $.trim(top) == "0" ? "" : top;
	left = $.trim(left) == "0" ? "" : left;
	
	setValue += "width=" + width;
	setValue += ",height=" + ( parseInt(height, 10) + (isCookie == 1 ? 40 : 0 ) );
	setValue += top == "" ? "" : ",top=" + top;
	setValue += left == "" ? "" : ",left=" + left;
	setValue += ",toolbar=no,menubar=no,location=no, scrollbars=no, status=no, resizable=no";
	
	if ( isCookie != 1 ) {
		window.open("/home/popup.aspx?seqno=<%=item.SeqNo %>", "popup<%=item.SeqNo %>", setValue);
	} else {
		var val = $.Cookie.GetCookie("Popup_<%=item.SeqNo %>");
		if (val != 1 )
		{
			window.open("/home/popup.aspx?seqno=<%=item.SeqNo %>", "popup<%=item.SeqNo %>", setValue);
		}
	}
});
</script>
<% } %>

<script language="javascript" type="text/javascript">
(function($) {
	$.CenterBanner = {};
	
	$.CenterBanner = {
		Count : 0,
		Location : 0,
		Init : function() {
			$.CenterBanner.Count = $("#tblCenterBanner div.m_CenterBanner").size();
			if ( $.CenterBanner.Count > 1 )
				$.CenterBanner.Rolling();
		},
		
		Rolling : function() {
			setTimeout(function() {
				$("#tblCenterBanner div.m_CenterBanner:eq(" + $.CenterBanner.Location + ")").fadeOut(3000, function() {
				});
				$.CenterBanner.Location ++;
				if ( $.CenterBanner.Location >= $.CenterBanner.Count )
					$.CenterBanner.Location = 0;

				$("#tblCenterBanner div.m_CenterBanner:eq(" + $.CenterBanner.Location + ")").fadeIn(3000, function() { 
					$.CenterBanner.Rolling();
				});
			}, 4000 );
		}
	}
	
	$(function() {
		$.CenterBanner.Init();
	});
})(jQuery);
</script>
</asp:Content>
